import { Component, OnInit } from '@angular/core';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { HttpClient } from '@angular/common/http';
import { ResultList } from '../result-list';
import { RequestMapping } from '../request.mapping';
import { MessageFormComponent } from '../message-form/message-form.component';

@Component({
  selector: 'app-message',
  templateUrl: './message.component.html',
  styleUrls: ['./message.component.css']
})
export class MessageComponent implements OnInit {
  isCollapsed = false;
  page: any;

  _dataSet = [];
  _allChecked = false;
  _indeterminate = false;

  constructor(public modalService: NzModalService, public http: HttpClient, public messageService: NzMessageService) { }

  ngOnInit() {
    this.loadData();
  }
  loadData() {
    this.http.get<ResultList>(RequestMapping.MESSAGES).subscribe(response => {
      this._dataSet = response.data;
    })
  }


  openMessageForm() {
    const modal = this.modalService.open(
      {
        title: "发送消息", content: MessageFormComponent, footer: false
      })

      modal.on("onDestroy",() =>{
        // alert("在这重新加载");
      })



  }

}
